package com.atguigu.stgy.app.service.impl;

import com.atguigu.stgy.app.service.LeaseAgreementService;
import com.atguigu.stgy.app.service.UserInfoService;
import com.atguigu.stgy.common.interceptor.StgyAuthInterceptor;
import com.atguigu.stgy.model.entity.LeaseAgreement;
import com.atguigu.stgy.model.entity.UserInfo;
import com.atguigu.stgy.model.vo.AgreementDetailVo;
import com.atguigu.stgy.model.vo.AgreementItemVo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
//import com.atguigu.stgy.model.entity.LeaseAgreement;
import com.atguigu.stgy.app.mapper.LeaseAgreementMapper;

import java.util.List;

@Service
public class LeaseAgreementServiceImpl extends ServiceImpl<LeaseAgreementMapper, LeaseAgreement> implements LeaseAgreementService {
    @Resource
    UserInfoService userInfoService;
    @Override
    public List<AgreementItemVo> listItem() {
        Long userId = StgyAuthInterceptor.THREAD_LOCAL.get();
        UserInfo userInfo = userInfoService.getById(userId);
        //使用手机号查询用户的租约信息
        return baseMapper.selectListByPhone(userInfo.getPhone());
    }

    @Override
    public AgreementDetailVo getDetailById(Long id) {



        return baseMapper.selectDetailById(id);
    }
}
